//加密方法
export function doEncrypt(msgString) { 
    let msg = msgString;
    if (typeof (msgString) !== 'string') {
        msg = JSON.stringify(msgString);
    }
    let sm2 = require('sm-crypto').sm2;
    let cipherMode = 0; // 1 - C1C3C2，0 - C1C2C3，默认为1
    let publicKey = 'MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAE5cjiiACkla4JYYXbFxqC5At+Pma69wMYoW+bLU2Oc1g+PKzCuDL0lXDF+kP0GOvjvEzib1ereg5NKXU58Sqpfw=='; // 公钥
    let encryptData = sm2.doEncrypt(msg, publicKey, cipherMode); // 加密结果
    return encryptData;
}
